home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / MEMORY / OLD / MEM208SRC / FSLib / h / interface < prev    next >
Text File  |  1993-08-22  |  12KB  |  324 lines

  1. /* Original code (c) Acorn Computers Ltd, 1992-3 */
  2.  
  3. /* $Id: h.interface 3.1 93/03/09 23:32:18 brian Exp $ */
  4. #ifndef __interface_h
  5. #define __interface_h
  6.  
  7. #ifndef _kernel_HOST_UNDEFINED
  8. #include "kernel.h"
  9. #endif
  10.  
  11. typedef int YesNoAnswer;
  12. #define No (0)
  13. #define Yes (!No)
  14.  
  15. typedef int FileSwitchHandle;
  16. typedef int FileSystemHandle;
  17.  
  18. typedef union Information_Fields
  19. {
  20.         struct
  21.         {
  22.                 char                    *load_address;
  23.                 char                    *execute_address;
  24.         }       load_exec;
  25.         struct
  26.         {
  27.                 int                     part_1;
  28.                 int                     part_2;
  29.         }       date_type;
  30. }       Information_Fields;
  31.  
  32. typedef enum FSEntry_Open_Reason
  33. {
  34.         FSEntry_Open_Reason_OpenRead = 0,
  35.         FSEntry_Open_Reason_CreateUpdate = 1,
  36.         FSEntry_Open_Reason_Update = 2
  37. }       FSEntry_Open_Reason;
  38.  
  39. #define InformationWord_WritePermitted                  0x80000000
  40. #define InformationWord_ReadPermitted                   0x40000000
  41. #define InformationWord_ObjectIsDirectory               0x20000000
  42. #define InformationWord_UnbufferedOS_GBPBSupported      0x10000000
  43. #define InformationWord_StreamIsInteractive             0x08000000
  44.  
  45. typedef union FSEntry_Open_Parameter
  46. {
  47.         struct  open_definition
  48.         {
  49.                 FSEntry_Open_Reason     reason;
  50.                 char                    *filename;
  51.                 int                     padding_1;
  52.                 FileSwitchHandle        handle;
  53.                 int                     padding_4;
  54.                 int                     padding_5;
  55.                 char                    *special_field;
  56.         }       open_definition;
  57.         struct  open_result
  58.         {
  59.                 int                     information_word;
  60.                 FileSystemHandle        handle;
  61.                 int                     buffer_size;
  62.                 int                     file_extent;
  63.                 int                     allocated_space;
  64.         }       open_result;
  65. }       FSEntry_Open_Parameter;
  66. typedef _kernel_oserror *(FSEntry_Open_Function)( FSEntry_Open_Parameter * );
  67.  
  68. typedef union FSEntry_GetBytes_Parameter
  69. {
  70.         struct
  71.         {
  72.                 int                     filler;
  73.                 FileSystemHandle        handle;
  74.                 char                    *destination_start;
  75.                 int                     bytes_to_read;
  76.                 int                     file_offset_to_get_data_from;
  77.         }       getbytes_definition;
  78.         struct
  79.         {
  80.                 int                     byte_got;
  81.                 YesNoAnswer             got_the_byte;
  82.         }       getbytes_result;
  83. }       FSEntry_GetBytes_Parameter;
  84. typedef _kernel_oserror *(FSEntry_GetBytes_Function)( FSEntry_GetBytes_Parameter * );
  85.  
  86. typedef struct FSEntry_PutBytes_Parameter
  87. {
  88.         char                            byte_to_put;
  89.         char                            filler_1;
  90.         char                            filler_2;
  91.         char                            filler_3;
  92.         FileSystemHandle                handle;
  93.         char                            *source_start;
  94.         int                             bytes_to_write;
  95.         int                             file_offset_to_put_data_to;
  96. }       FSEntry_PutBytes_Parameter;
  97. typedef _kernel_oserror *(FSEntry_PutBytes_Function)( FSEntry_PutBytes_Parameter * );
  98.  
  99. typedef enum FSEntry_Args_Reason
  100. {
  101.         FSEntry_Args_Reason_ReadSequentialFilePointer = 0,
  102.         FSEntry_Args_Reason_WriteSequentialFilePointer = 1,
  103.         FSEntry_Args_Reason_ReadFileExtent = 2,
  104.         FSEntry_Args_Reason_WriteFileExtent = 3,
  105.         FSEntry_Args_Reason_ReadSizeAllocatedToFile = 4,
  106.         FSEntry_Args_Reason_EOFCheck = 5,
  107.         FSEntry_Args_Reason_FlushFileBuffer = 6,
  108.         FSEntry_Args_Reason_EnsureFileSize = 7,
  109.         FSEntry_Args_Reason_WriteZerosToFile = 8,
  110.         FSEntry_Args_Reason_ReadFileDateStamp = 9,
  111.         FSEntry_Args_Reason_InformOfNewImageStamp = 10
  112. }       FSEntry_Args_Reason;
  113.  
  114. typedef struct FSEntry_Args_Parameter
  115. {
  116.         FSEntry_Args_Reason             reason;
  117.         union
  118.         {
  119.                 FileSystemHandle        handle;
  120.                 YesNoAnswer             Not_Yet_EOF;
  121.         }       _;
  122.         union
  123.         {
  124.                 int                     sequential_pointer;
  125.                 int                     extent;
  126.                 int                     allocation_size;
  127.                 Information_Fields      info;
  128.                 struct
  129.                 {
  130.                         int             start;
  131.                         int             number;
  132.                 }       write_zeros;
  133.                 int                     new_image_stamp;
  134.         }       arg;
  135. }       FSEntry_Args_Parameter;
  136. typedef _kernel_oserror *(FSEntry_Args_Function)( FSEntry_Args_Parameter * );
  137.  
  138. typedef struct FSEntry_Close_Parameter
  139. {
  140.         int                             padding;
  141.         FileSystemHandle                handle;
  142.         Information_Fields              info;
  143. }       FSEntry_Close_Parameter;
  144. typedef _kernel_oserror *(FSEntry_Close_Function)( FSEntry_Close_Parameter * );
  145.  
  146. typedef enum FSEntry_File_Reason
  147. {
  148.         FSEntry_File_Reason_LoadFile = 0xff,
  149.         FSEntry_File_Reason_SaveFile = 0,
  150.         FSEntry_File_Reason_WriteCatalogueInformation = 1,
  151.         FSEntry_File_Reason_WriteLoadAddress = 2,
  152.         FSEntry_File_Reason_WriteExecutionAddress = 3,
  153.         FSEntry_File_Reason_WriteAttributes = 4,
  154.         FSEntry_File_Reason_ReadCatalogueInformation = 5,
  155.         FSEntry_File_Reason_DeleteObject = 6,
  156.         FSEntry_File_Reason_CreateFile = 7,
  157.         FSEntry_File_Reason_CreateDirectory = 8,
  158.         FSEntry_File_Reason_ReadCatalogueInformationNoLength = 9,
  159.         FSEntry_File_Reason_ReadBlockSize = 10
  160. }       FSEntry_File_Reason;
  161.  
  162. typedef struct FSEntry_File_Parameter
  163. {
  164.         FSEntry_File_Reason             reason;
  165.         char                            *name;
  166.         Information_Fields              info;
  167.         union
  168.         {
  169.                 struct
  170.                 {
  171.                         int             length;
  172.                         int             attributes;
  173.                 }       info;
  174.                 struct
  175.                 {
  176.                         char            *start;
  177.                         char            *end;
  178.                 }       location;
  179.         }       extras;
  180.         char                            *special_field;
  181. }       FSEntry_File_Parameter;
  182. typedef _kernel_oserror *(FSEntry_File_Function)( FSEntry_File_Parameter * );
  183.  
  184. typedef enum FSEntry_Func_Reason
  185. {
  186.         FSEntry_Func_Reason_SetCurrentDirectory = 0,
  187.         FSEntry_Func_Reason_SetLibraryDirectory = 1,
  188.         FSEntry_Func_Reason_CatalogueDirectory = 2,
  189.         FSEntry_Func_Reason_ExamineCurrentDirectory = 3,
  190.         FSEntry_Func_Reason_CatalogueLibraryDirectory = 4,
  191.         FSEntry_Func_Reason_ExamineLibraryDirectory = 5,
  192.         FSEntry_Func_Reason_ExamineObjects = 6,
  193.         FSEntry_Func_Reason_SetFilingSystemOptions = 7,
  194.         FSEntry_Func_Reason_RenameObject = 8,
  195.         FSEntry_Func_Reason_AccessObjects = 9,
  196.         FSEntry_Func_Reason_BootFilingSystem = 10,
  197.         FSEntry_Func_Reason_ReadNameAndBootOptionOfDisc = 11,
  198.         FSEntry_Func_Reason_ReadCurrentDirectoryNameAndPrivilegeByte = 12,
  199.         FSEntry_Func_Reason_ReadLibraryDirectoryNameAndPrivilegeByte = 13,
  200.         FSEntry_Func_Reason_ReadDirectoryEntries = 14,
  201.         FSEntry_Func_Reason_ReadDirectoriesAndInformation = 15,
  202.         FSEntry_Func_Reason_ShutDown = 16,
  203.         FSEntry_Func_Reason_PrintStartUpBanner = 17,
  204.         FSEntry_Func_Reason_SetDirectoryContexts = 18,
  205.         FSEntry_Func_Reason_ReadDirectoryEntriesAndInformation = 19,
  206.         FSEntry_Func_Reason_OutputFullInformationOnObjects = 20,
  207.         FSEntry_Func_Reason_NotificationOfNewImage = 21,
  208.         FSEntry_Func_Reason_NotificationOfImageAboutToBeClosed = 22,
  209.         FSEntry_Func_Reason_CanonicaliseSpecialFieldAndDiscName = 23,
  210.         FSEntry_Func_Reason_ResolveWildcard = 24,
  211.         FSEntry_Func_Reason_ReadDefectList = 25,
  212.         FSEntry_Func_Reason_AddADefect = 26,
  213.         FSEntry_Func_Reason_ReadBootOption = 27,
  214.         FSEntry_Func_Reason_WriteBootOption = 28,
  215.         FSEntry_Func_Reason_ReadUsedSpaceMap = 29,
  216.         FSEntry_Func_Reason_ReadFreeSpace = 30,
  217.         FSEntry_Func_Reason_NameImage = 31,
  218.         FSEntry_Func_Reason_StampImage = 32,
  219.         FSEntry_Func_Reason_GetUsageOfOffset = 33
  220. }       FSEntry_Func_Reason;
  221.  
  222. typedef struct FSEntry_Func_Parameter
  223. {
  224.         FSEntry_Func_Reason             reason;
  225.         union
  226.         {
  227.                 char                    *name_1;
  228.                 FileSystemHandle        csd;
  229.                 YesNoAnswer             rename_invalid;
  230.         }       first_parameter;
  231.         union
  232.         {
  233.                 char                    *name_2;
  234.                 int                     parameter;
  235.                 char                    *access_string;
  236.                 char                    *destination_address;
  237.                 FileSystemHandle        urd;
  238.         }       second_parameter;
  239.         union
  240.         {
  241.                 int                     read_number;
  242.                 FileSystemHandle        library;
  243.         }       third_parameter;
  244.         int                             read_offset;
  245.         int                             buffer_length;
  246.         char                            *special_field_1;
  247.         char                            *special_field_2;
  248. }       FSEntry_Func_Parameter;
  249. typedef _kernel_oserror *(FSEntry_Func_Function)( FSEntry_Func_Parameter * );
  250.  
  251. typedef enum FSEntry_GBPB_Reason
  252. {
  253.         FSEntry_GBPB_Reason_PutMultipleBytesHere = 1,
  254.         FSEntry_GBPB_Reason_PutMultipleBytes = 2,
  255.         FSEntry_GBPB_Reason_GetMultipleBytesHere = 3,
  256.         FSEntry_GBPB_Reason_GetMultipleBytes = 4
  257. }       FSEntry_GBPB_Reason;
  258.  
  259. typedef struct FSEntry_GBPB_Parameter
  260. {
  261.         FSEntry_GBPB_Reason             reason;
  262.         FileSystemHandle                handle;
  263.         char                            *address;
  264.         int                             number;
  265.         int                             sequential_file_pointer;
  266. }       FSEntry_GBPB_Parameter;
  267. typedef _kernel_oserror *(FSEntry_GBPB_Function)( FSEntry_GBPB_Parameter * );
  268.  
  269. typedef enum FSEntry_Free_Reason
  270. {
  271.         FSEntry_Free_Reason_NoOp = 0,
  272.         FSEntry_Free_Reason_GetDeviceName = 1,
  273.         FSEntry_Free_Reason_GetFreeSpace = 2,
  274.         FSEntry_Free_Reason_CompareDevice = 3
  275. }       FSEntry_Free_Reason;
  276.  
  277. typedef struct FSEntry_Free_Parameter
  278. {
  279.         FSEntry_Free_Reason             reason;
  280.         int                             FS_number;
  281.         union {
  282.                 char    *name;
  283.                 int     *buffer;
  284.                 } third_parameter;
  285.         char *                          device_id;
  286.         int                             dummy;  
  287.         int                             dummy2;
  288.         char *                          special_field;
  289. }       FSEntry_Free_Parameter;
  290.  
  291. /*
  292.  * Assembler routines that provide FS interface
  293.  */
  294.  
  295. extern void veneer_fsentry_open( void );
  296. extern void veneer_fsentry_getbytes( void );
  297. extern void veneer_fsentry_putbytes( void );
  298. extern void veneer_fsentry_args( void );
  299. extern void veneer_fsentry_close( void );
  300. extern void veneer_fsentry_file( void );
  301. extern void veneer_fsentry_func( void );
  302. extern void veneer_fsentry_gbpb( void );
  303. extern void veneer_fsentry_free( void );
  304.  
  305. /*
  306.  * Routines called by FS interface
  307.  */
  308.  
  309. extern  _kernel_oserror *fsentry_open( FSEntry_Open_Parameter * );
  310. extern  _kernel_oserror *fsentry_getbytes( FSEntry_GetBytes_Parameter * );
  311. extern  _kernel_oserror *fsentry_putbytes( FSEntry_PutBytes_Parameter * );
  312. extern  _kernel_oserror *fsentry_args( FSEntry_Args_Parameter * );
  313. extern  _kernel_oserror *fsentry_close( FSEntry_Close_Parameter * );
  314. extern  _kernel_oserror *fsentry_file( FSEntry_File_Parameter * );
  315. extern  _kernel_oserror *fsentry_func( FSEntry_Func_Parameter * );
  316. extern  _kernel_oserror *fsentry_gbpb( FSEntry_GBPB_Parameter * );
  317. extern  _kernel_oserror *fsentry_free( FSEntry_Free_Parameter * );
  318.  
  319. extern const int *Image_RO_Base;
  320.  
  321. #define Information_Block_Size          11
  322.  
  323. #endif
  324.